#############可执行文件config_test########################

# 添加配置测试程序
file(GLOB TEST_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/config_test_main.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../src/common/*.cpp")

add_executable(config_test ${TEST_SOURCES})

target_include_directories(config_test PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/../src
    ${CMAKE_CURRENT_SOURCE_DIR}/../src/common
    ${HIREDIS_INCLUDE_DIR}
)


target_link_libraries(config_test PRIVATE
    # ${HIREDIS_LIBRARY}
    nlohmann_json::nlohmann_json
    spdlog::spdlog
) 

# 拷贝配置文件
add_custom_command(TARGET config_test POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy_if_different
        ${CMAKE_CURRENT_SOURCE_DIR}/../config/config.json
        $<TARGET_FILE_DIR:config_test>/config.json
)

#############可执行文件json_test########################

# 添加JSON测试程序
add_executable(json_test json_test.cpp)

target_include_directories(json_test PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/../src
)

target_link_libraries(json_test PRIVATE
    nlohmann_json::nlohmann_json
)

#############可执行文件redis_test########################

# 添加Redis测试程序
add_executable(redis_test redis_test.cpp)

target_include_directories(redis_test PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/../src
    ${CMAKE_CURRENT_SOURCE_DIR}/../src/common
    ${HIREDIS_INCLUDE_DIR}
)

target_link_libraries(redis_test PRIVATE
    ${HIREDIS_LIBRARY}
    nlohmann_json::nlohmann_json
    spdlog::spdlog
)

#############可执行文件mysql_test########################

# 添加MySQL测试程序
add_executable(mysql_test mysql_test.cpp)

target_include_directories(mysql_test PRIVATE
    # ${CMAKE_CURRENT_SOURCE_DIR}
    # ${CMAKE_CURRENT_SOURCE_DIR}/../src
    # ${CMAKE_CURRENT_SOURCE_DIR}/../src/common
    ${MYSQL_INCLUDE_DIR}
)

target_link_libraries(mysql_test PRIVATE
    ${MYSQL_LIBRARIES}
    # nlohmann_json::nlohmann_json
    # spdlog::spdlog
)

#############可执行文件asio_test_server########################

# 添加Asio服务器测试程序
add_executable(asio_test_server asio_test_server.cpp)

target_include_directories(asio_test_server PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/../src
    ${ASIO_INCLUDE_DIR}
)

target_link_libraries(asio_test_server PRIVATE
    nlohmann_json::nlohmann_json
    Boost::system
    Threads::Threads
)

#############可执行文件asio_test_client########################

# 添加Asio客户端测试程序
add_executable(asio_test_client asio_test_client.cpp)

target_include_directories(asio_test_client PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/../src
    ${ASIO_INCLUDE_DIR}
)

target_link_libraries(asio_test_client PRIVATE
    nlohmann_json::nlohmann_json
    Boost::system
    Threads::Threads
)

#############可执行文件websocket_test_client########################

# 添加WebSocket客户端测试程序
add_executable(websocket_test_client websocket_test_client.cpp)

target_include_directories(websocket_test_client PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/../src
    ${ASIO_INCLUDE_DIR}
)

target_link_libraries(websocket_test_client PRIVATE
    ${Boost_LIBRARIES}
    nlohmann_json::nlohmann_json
    Threads::Threads
)# 